package annotation;

import controller.UserController;
import core.RequestMappingAdapter;
import core.SingletonFactory;
import request.user.UserRegisterRequest;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 标识一个类是Controller，该类必须同时被注解为{@link Singleton}，并且能由{@link SingletonFactory}得到
 * <p>实际上与{@link RequestMapping}配合，用于{@link RequestMappingAdapter}
 * <p>Controller不能直接访问DAO，而是将请求中的参数提取出来转发给Service
 * <p>Controller也能进行一些简单的参数检验，如{@link UserController#register(UserRegisterRequest)}
 */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Controller {
}
